package com.hs.biye.model.reslut;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T>  {
    private Integer code;
    private T data;
    private String msg;


    public static <T> Result<T> success() {
        Result<T> result = new Result<T>();
        result.code = 0;
        return result;
    }

    public static <T> Result<T> success(T data) {
        Result<T> result = new Result<>();
        result.code = 0;
        result.data = data;
        return result;
    }
    public static <T> Result<T> success(T data,String msg){
        Result<T> result = new Result<>();
        result.code = 0;
        result.data = data;
        result.msg = msg;
        return result;
    }


    public static <T> Result<T> faile(String msg) {
        Result<T> result = new Result<T>();
        result.code = 1;
        result.msg = msg;
        result.data = null;
        return result;
    }
}